1. Field of the Invention
The present invention relates to a computer system, and deals more particularly with a method, system, and computer-readable code for retrieving style sheets from a directory or other repository, based upon partial characteristic matching. Characteristics are associated with style sheets, and retrieval is accomplished by specifiying a pattern which includes one or more of the characteristics. Preferably, the style sheet characteristcs are stored as LDAP (Lightweight Directory Access Protocol) objects in an LDAP directory.
2. Description of the Related Art
A xe2x80x9cstyle sheetxe2x80x9d is a specification of a style that is to be used when presenting a document. The style specification includes information such as the font and margins to be used, the formatting layout, and other types of information that indicate how the presented document should appear. Style sheets can be used for many types of presentation of a document, including printing the document, displaying it on a video display, processing the document by a speech synthesizer, etc. Consequently, style sheets may also be utilized to describe transformations from one document type to another (e.g. from MathML to HTML) or as filters which describe transformations to reduce the amount of content while maintaining the original document type.
One type of style sheet is an XSL Style Sheet. XSL Style Sheets are style sheets specified in XSL, which is a particular style sheet language. xe2x80x9cXSLxe2x80x9d is an acronym for xe2x80x9cExtensible Stylesheet Languagexe2x80x9d. An XSL Style Sheet specifies how an XML document is to be transformed for presentation, resulting in a different document which may or may not maintain the original document type. xe2x80x9cXMLxe2x80x9d is an acronym for xe2x80x9cExtensible Markup Language, and is a trademark of Massachusetts Institute of Technology. XML is a standardized formatting notation, created for structured document interchange on the World Wide Web (hereinafter, xe2x80x9cWebxe2x80x9d). (Refer to xe2x80x9cExtensible Markup Language (XML), W3C Recommendation Feb. 10, 1998xe2x80x9d which is available on the World Wide Web at http://www.w3.org/TR/1998/REC-xml-19980210, for more information on XML; and to xe2x80x9cExtensible Stylesheet Language (XSL), Version 1.0, World Wide Web Consortium Working Draft Dec. 16, 1998xe2x80x9d, hereinafter xe2x80x9cXSL Specificationxe2x80x9d, which is available on the Web at http://www.w3.org/TR/WD-xsl, for more information on XSL.)
Style sheets include xe2x80x9ctemplate rulexe2x80x9d constructs, which define an input pattern and a template (also known as an xe2x80x9cactionxe2x80x9d) to use in creating an output result tree fragment. When applying a style sheet, the patterns in the templates are matched against the syntax of the source document. When a match is found with the template pattern, an output document fragment is created according to the actions specified in the template (which may include processing additional elements in the source document beyond the matching element). The source document is parsed recursively, until no more matching patterns are found. The resulting document fragments are then aggregated to yield a complete output document. (For more information on this process, refer to section 2, xe2x80x9cTree Constructionxe2x80x9d, in the XSL Specification.) It is this template matching and substitution of different document elements according to the actions in the matching rules that enables style sheets to transform documents. (While the term xe2x80x9cdocumentxe2x80x9d is used herein when discussing encoded data and application of style sheets thereto, it is to be understood that the information on which a style sheet operates may represent any type of information, and is not limited to the traditional interpretation of the word xe2x80x9cdocumentxe2x80x9d. As one example, a style sheet may be used to process an encoded representation of records from a data repository which specify a company""s sales data. As another example, a style sheet may be used to format employee information retrieved from a corporate database for presentation. For ease of reference, the term xe2x80x9cdocumentxe2x80x9d will be used herein to refer to these diverse types of information.)
XML is emerging as a powerful methodology for representing document content, due to its ability to store data in a self-defining, portable manner. Style sheet languages such as XSL, along with their associated processors, are powerful tools for filtering data content encoded in notations such as XML, as well as for transforming documents encoded in one markup language into other markup languages (or vocabularies) such as HTML (HyperText Markup Language) or WML (Wireless Markup Language). XML documents are evolving in a manner in which style sheets are also being used to perform custom tailoring of content information. For example, style sheets may be written to search for and extract a specific subset of the information contained in the XML document. Or, a style sheet might tailor the information so that it can be delivered to a particular device, transforming the document for the characteristics of the device (such as which browser will be used to render the document, the screen size of the device, whether the screen supports color or grayscale, etc.). The need to perform this type of content tailoring is increasing rapidly as the popularity of new types of computing devices, such as pervasive computing devices, increases. Pervasive computing devices are typically small, constrained-storage devices such as xe2x80x9cSmart Phonesxe2x80x9d or the WorkPad device from the International Business Machines Corporation (IBM). (xe2x80x9cWorkPadxe2x80x9d is a registered trademark of IBM.) These devices are typically designed to be portable, and therefore are often connected to a network using a relatively expensive wireless connection, which may have limited bandwidth. Pervasive computing devices are often quite different from the devices an end-user might use in an office setting, such as a desktop computer. For example, the display screen on the devices may be quite small, and may not support color display, audio, etc. Thus, XML documents which were originally created with the expectation that the document would be rendered on a full-function desktop computer may contain a significant amount of content that cannot be presented to the user of the smaller, low-end device. In fact, when a document includes large objects such as image, video, or audio files, it is quite possible that the low-end device will not have sufficient storage space to even receive the document. In the current art, the style sheet that is to be used for transforming a document is specified statically, using various techniques such as an in-line style sheet encoded within a document, or an externally-stored style sheet that is referenced from a document using a processing instruction. As more and more new types of computing devices are developed, the less likely it will be that a document content developer will be able to predict the environment in which his document will be rendered and the more likely it will be that the document will contain content inappropriate for users having a wide variety of computing devices, such that a statically-specified style sheet is no longer adequate.
In view of this situation, it would be desirable to dynamically select one or more style sheets that tailor a document for presentation in a specific target environment. For pervasive computing devices, it will often be useful to filter audio data out of the document, to perform transcoding processes to replace full-color images with grayscale images, etc. These types of transformations would adapt the content to the device""s physical capabilities, as well as greatly reduce the size of the document (thereby reducing the cost of transmitting the document, and increasing the likelihood that sufficient storage space will be available for receiving the document). In addition to tailoring a document for the characteristics of the device, it would also be beneficial to determine that a specific browser is running on the device, and transform the document for rendering by that browser when necessary. For example, a document encoded in a data file may not include any images or video files (and therefore might not benefit significantly from a reduction in size), but it may be desirable to transmit this document from a server to a particular handheld device. If the document is encoded in one markup language, such as XML, while the browser on the device is only capable of supporting a different markup language such as WML or WBXML (xe2x80x9cWireless Application Protocol Binary XMLxe2x80x9d), then a transformation process needs to be performed. An appropriate transforming style sheet may be used to perform these transformation processes. Transformations of this type may be beneficial in the wireless environment and with pervasive computing devices, and in any other environment where it is desirable to transform the content in a file. (Note that the word xe2x80x9cfilexe2x80x9d is used in this disclosure to refer to stored data. This is for ease of reference only, and is not meant to imply any particular structure for storing the data, such as conventional xe2x80x9cflat filesxe2x80x9d. The data with which the present invention may be beneficially used may be stored in any number of ways without deviating from the inventive concepts disclosed herein, such as: a data element in a database, an object attribute in a directory entry, an object in flash memory, etc.)
The preceding discussion illustrates the valuable role that transforming style sheets have to play in tailoring content based on device characteristics. In addition, transformations based upon user preferences (such as may be stored in a directory or other repository) would also be beneficial. For example, a user preference may specify that all documents are to be presented using large fonts, or avoiding specific colors on a display, or using a voice synthesizer. A style sheet can be written that transforms documents to address these user preferences.
Some significant problems associated with using style sheets to tailor document content in this manner have been addressed. The first related invention, xe2x80x9cDynamically Determining the Most Appropriate Location for Style Sheet Applicationxe2x80x9d, determines whether the appropriate location for applying style sheets to transform a document is the server (and/or a Web proxy) or the client. This determination considers such factors as whether the client device has the capability for style sheet processing and whether it can resolve any dynamic parameters (such as user preferences) in a style sheet, and then adapts the style sheets accordingly. The second related invention, xe2x80x9cAchieving Complex Transformations with Dynamic Style Sheet Coalescingxe2x80x9d, discloses a novel technique for dynamically determining one or more transformations that may be used to transform an input document in a first notation into a document in a different notation, where the output notation is tailored to (among other things) the target environment where the document will be rendered for presentation. However, a number of areas remain which need to be addressed in order for style sheets to be used optimally in transforming documents for their target environment.
One issue that remains with using style sheets to tailor document content for its target environment is the ability to retrieve the style sheet (or sheets) that will provide a transformation that is most appropriate for the characteristics of this target environment. Preferably, the style sheet selected and retrieved would be one that most closely matches any user preferences, and is suitable for the device and browser. One approach to solving this problem would be to send a group of style sheets to a proxy or a browser, with the most appropriate style sheet being selected at that location. However, this assumes that such a selection mechanism is available, which is unlikely. Furthermore, this approach may waste a significant amount of network bandwidth if a large number of potential style sheets exist.
A second issue that remains with using style sheets to tailor document content for its target environment is that, in some cases, the user may have custom style sheets which are more appropriate for his needs than other available style sheets which perform more general transformations. In this situation, it would be beneficial to attempt to retrieve the user-specific style sheets whenever appropriate, using more general style sheets as a default when the custom style sheet cannot be used.
Accordingly, a need exists for a technique by which the problems discussed above for retrieving style sheets which tailor document content to a target environment can be addressed.
The present invention provides a technique for associating characteristics with style sheets, and using those characteristics in a pattern-matching process to select and retrieve one or more style sheets that are appropriate in a given situation.
An object of the present invention is to provide a technique for using style sheet characteristics to select and retrieve an appropriate style sheet for a target environment.
Another object of the present invention is to provide this technique whereby the pattern matching process uses a selected subset of the style sheet characteristics.
Yet another object of the present invention is to provide this technique whereby the characteristics represent user preferences and/or device and browser capabilities.
A further object of the present invention is to provide this technique whereby a directory database is used to store the style sheet characteristics, such that the pattern-matching process leverages existing search facilities.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a method, system, and computer-readable code for use in a computing environment capable of having a connection to a network, for retrieving style sheets from a repository based upon partial characteristic mapping. This technique comprises: associating one or more characteristics with each of one or more style sheets;
extracting each of the associated characteristics for selected ones of the style sheets; and storing the extracted characteristics for each of the selected style sheets in the repository, along with an identifier of the selected style sheet to which the stored characteristics pertain. The technique may further comprise: specifying a pattern for a desired set of characteristics; matching the pattern against a collection of the stored characteristics from the repository; and retrieving a particular style sheet using the style sheet identifier located by the matching when the matching has a successful result. Preferably, the associated characteristics are specified as pairs, each of the pairs comprising a characteristic identifier and a characteristic value for the identifier. The pattern may comprise one or more sub-patterns, each of the sub-patterns comprising a specified characteristic identifier and a specified characteristic value, wherein the specified characteristic identifier and the specified characteristic value may use one or more wildcard characters.
In one aspect, the technique further comprises: creating an object, wherein the object comprises: a first attribute, a second attribute, and a third attribute; and wherein the storing further comprises: storing a unique identifier of the object in the first attribute; storing the stored extracted characteristics in the second attribute, wherein the characteristic pairs are delimited from one another using a first special character and wherein the characteristic identifier is delimited from the characteristic value in each of the pairs using a second special character; and storing the identifier of the selected style sheet in the third attribute.
In another aspect, the technique further comprises: creating an object, wherein the object comprises: a first attribute, a second attribute, and a third attribute; and wherein the storing further comprises: storing a unique identifier of the object in the first attribute; storing the extracted characteristics as an unordered set of values in the second attribute, wherein each of the values stores one of the pairs; and storing the identifier of the selected style sheet in the third attribute. In this aspect, the characteristic identifier and the characteristic value in each of the pairs may be delimited using a special character.
In these aspects, the repository may be a directory database. This directory database may be an LDAP database, and the object may be an LDAP object.